//
//  JMFBase.h
//  nonghubao
//
//  Created by 王 文彬 on 13-2-25.
//  Copyright (c) 2013年 Chongqing Nonghubao Co., Ltd. All rights reserved.
//


#import <Foundation/Foundation.h>

@interface JMFBase : NSObject
{
    NSString*       _message;
    NSString*       _error;
    NSInteger       _status;
    NSDictionary*   _data;
}


typedef NS_ENUM(NSInteger, JMStatus) {
    JMStatusServerError = 0,
    JMStatusSucceed,
    JMStatusInvald,
    JMStatusParamError,
    JMStatusFailed,
    JMStatusOther,
    JMStatusTokenError
};


//通过一个JSON形式的NSDictionary来实例化
- (id)initWithJSONDictionary:(NSDictionary *)dictionary;

@property (readonly, nonatomic, strong) NSString*      message;
@property (readonly, nonatomic, assign) NSInteger      status;
@property (readonly, nonatomic, strong) NSString*      error;
@property (readonly, nonatomic, strong) NSDictionary*  data;


- (id)         idValue:      (NSString *)path;
- (BOOL)       boolValue:    (NSString *)path;
- (NSString *) stringValue:  (NSString *)path;
- (NSNumber *) numberValue:  (NSString *)path;
- (NSObject *) objectValue:  (NSString *)path;
- (NSInteger)  integerValue: (NSString *)path;

@end
